//package com.zmn.plat.task.job.contract;
//
//import com.github.ltsopensource.spring.tasktracker.LTS;
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.plat.business.interfaces.dingtalk.DingTalkService;
//import com.zmn.plat.business.interfaces.msg.MsgBService;
//import com.zmn.plat.common.exception.PlatException;
//import com.zmn.plat.dubbo.dto.msg.MsgDIO;
//import com.zmn.plat.model.entity.contract.record.ContractRecord;
//import com.zmn.plat.services.interfaces.contract.record.ContractRecordService;
//import com.zmn.plat.services.interfaces.msg.conf.MsgConfService;
//import com.zmn.plat.services.interfaces.push.PushInfoService;
//import com.zmn.plat.services.interfaces.push.ZmnSmsService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//
//import java.sql.Timestamp;
//import java.time.LocalDate;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//
//
///**
// * 合同预警base JOB：
// *
// * @author linfeng
// * @since 2020/05/25 15:28:09
// */
//@LTS
//public class ContractAlertBaseJob {
//
//    private Logger logger = LoggerFactory.getLogger(ContractAlertBaseJob.class);
//
//    @Autowired
//    private ContractRecordService contractRecordService;
//
//    @Autowired
//    private PushInfoService pushInfoService;
//
//    @Autowired
//    private MsgConfService msgConfService;
//
//    @Autowired
//    private DingTalkService dingTalkService;
//
//    @Autowired
//    private ZmnSmsService zmnSmsService;
//
//    @Autowired
//    private MsgBService msgBService;
//
//    boolean sendAllMsg(MsgDIO msgDIO) {
//        try {
//            return msgBService.sendMsg(msgDIO);
//        }catch (Exception e){
//            logger.error("sendAllMsg error",e);
//            return false;
//        }
//    }
//
//    /**
//     * 当前时间和传来的时间比较
//     *
//     * @param date 传来的时间
//     * @return 相差天数
//     */
//    public static int getBetweenNowDays(Date date) {
//        Timestamp timestamp = new Timestamp(date.getTime());
//        LocalDate now = LocalDate.now();
//        LocalDate end = timestamp.toLocalDateTime().toLocalDate();
//        return (int) (end.toEpochDay() - now.toEpochDay());
//    }
//
//    protected List<Integer> getFirstAlertReceiverStaffIds(ContractRecord contractRecord) {
//        List<Integer> ids = new ArrayList<>();
//        if (contractRecord == null) {
//            return ids;
//        }
//
//        if (contractRecord.getFirstAlertReceiver1() != null) {
//            ids.add(contractRecord.getFirstAlertReceiver1());
//        }
//        if (contractRecord.getFirstAlertReceiver2() != null) {
//            ids.add(contractRecord.getFirstAlertReceiver2());
//        }
//        if (contractRecord.getFirstAlertReceiver3() != null) {
//            ids.add(contractRecord.getFirstAlertReceiver3());
//        }
//
//        return ids;
//    }
//
//    protected List<Integer> getSecondAlertReceiverStaffIds(ContractRecord contractRecord) {
//        List<Integer> ids = new ArrayList<>();
//        if (contractRecord == null) {
//            return ids;
//        }
//
//        if (contractRecord.getSecondAlertReceiver1() != null) {
//            ids.add(contractRecord.getSecondAlertReceiver1());
//        }
//        if (contractRecord.getSecondAlertReceiver2() != null) {
//            ids.add(contractRecord.getSecondAlertReceiver2());
//        }
//        if (contractRecord.getSecondAlertReceiver3() != null) {
//            ids.add(contractRecord.getSecondAlertReceiver3());
//        }
//
//        return ids;
//    }
//
//    protected List<Integer> getOverdueAlertReceiverStaffIds(ContractRecord contractRecord) {
//        List<Integer> ids = new ArrayList<>();
//        if (contractRecord == null) {
//            return ids;
//        }
//
//        if (contractRecord.getOverdueAlertReceiver1() != null) {
//            ids.add(contractRecord.getOverdueAlertReceiver1());
//        }
//        if (contractRecord.getOverdueAlertReceiver2() != null) {
//            ids.add(contractRecord.getOverdueAlertReceiver2());
//        }
//        if (contractRecord.getOverdueAlertReceiver3() != null) {
//            ids.add(contractRecord.getOverdueAlertReceiver3());
//        }
//
//        return ids;
//    }
//
//}
